-
Notifications
You must be signed in to change notification settings - Fork 14.5k
[SPARC][IAS] Add support for %uhi and %ulo extensions #94246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
koachan
merged 4 commits into
main
from
users/koachan/spr/sparcias-add-support-for-uhi-and-ulo-extensions
Jun 9, 2024
Merged
[SPARC][IAS] Add support for %uhi and %ulo extensions #94246
koachan
merged 4 commits into
main
from
users/koachan/spr/sparcias-add-support-for-uhi-and-ulo-extensions
Jun 9, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Created using spr 1.3.4 [skip ci]
Created using spr 1.3.4
@llvm/pr-subscribers-mc @llvm/pr-subscribers-backend-sparc Author: Koakuma (koachan) ChangesThis adds support for GNU %uhi and %ulo extensions. Full diff: https://github.com/llvm/llvm-project/pull/94246.diff 2 Files Affected:
diff --git a/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp b/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp
index 522a8877a1c60..4688837e435e5 100644
--- a/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp
+++ b/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp
@@ -93,44 +93,46 @@ bool SparcMCExpr::printVariantKind(raw_ostream &OS, VariantKind Kind)
SparcMCExpr::VariantKind SparcMCExpr::parseVariantKind(StringRef name)
{
return StringSwitch<SparcMCExpr::VariantKind>(name)
- .Case("lo", VK_Sparc_LO)
- .Case("hi", VK_Sparc_HI)
- .Case("h44", VK_Sparc_H44)
- .Case("m44", VK_Sparc_M44)
- .Case("l44", VK_Sparc_L44)
- .Case("hh", VK_Sparc_HH)
- .Case("hm", VK_Sparc_HM)
- .Case("lm", VK_Sparc_LM)
- .Case("pc22", VK_Sparc_PC22)
- .Case("pc10", VK_Sparc_PC10)
- .Case("got22", VK_Sparc_GOT22)
- .Case("got10", VK_Sparc_GOT10)
- .Case("got13", VK_Sparc_GOT13)
- .Case("r_disp32", VK_Sparc_R_DISP32)
- .Case("tgd_hi22", VK_Sparc_TLS_GD_HI22)
- .Case("tgd_lo10", VK_Sparc_TLS_GD_LO10)
- .Case("tgd_add", VK_Sparc_TLS_GD_ADD)
- .Case("tgd_call", VK_Sparc_TLS_GD_CALL)
- .Case("tldm_hi22", VK_Sparc_TLS_LDM_HI22)
- .Case("tldm_lo10", VK_Sparc_TLS_LDM_LO10)
- .Case("tldm_add", VK_Sparc_TLS_LDM_ADD)
- .Case("tldm_call", VK_Sparc_TLS_LDM_CALL)
- .Case("tldo_hix22", VK_Sparc_TLS_LDO_HIX22)
- .Case("tldo_lox10", VK_Sparc_TLS_LDO_LOX10)
- .Case("tldo_add", VK_Sparc_TLS_LDO_ADD)
- .Case("tie_hi22", VK_Sparc_TLS_IE_HI22)
- .Case("tie_lo10", VK_Sparc_TLS_IE_LO10)
- .Case("tie_ld", VK_Sparc_TLS_IE_LD)
- .Case("tie_ldx", VK_Sparc_TLS_IE_LDX)
- .Case("tie_add", VK_Sparc_TLS_IE_ADD)
- .Case("tle_hix22", VK_Sparc_TLS_LE_HIX22)
- .Case("tle_lox10", VK_Sparc_TLS_LE_LOX10)
- .Case("hix", VK_Sparc_HIX22)
- .Case("lox", VK_Sparc_LOX10)
- .Case("gdop_hix22", VK_Sparc_GOTDATA_HIX22)
- .Case("gdop_lox10", VK_Sparc_GOTDATA_LOX10)
- .Case("gdop", VK_Sparc_GOTDATA_OP)
- .Default(VK_Sparc_None);
+ .Case("lo", VK_Sparc_LO)
+ .Case("hi", VK_Sparc_HI)
+ .Case("h44", VK_Sparc_H44)
+ .Case("m44", VK_Sparc_M44)
+ .Case("l44", VK_Sparc_L44)
+ .Case("hh", VK_Sparc_HH)
+ .Case("uhi", VK_Sparc_HH) // Nonstandard GNU extension
+ .Case("hm", VK_Sparc_HM)
+ .Case("ulo", VK_Sparc_HM) // Nonstandard GNU extension
+ .Case("lm", VK_Sparc_LM)
+ .Case("pc22", VK_Sparc_PC22)
+ .Case("pc10", VK_Sparc_PC10)
+ .Case("got22", VK_Sparc_GOT22)
+ .Case("got10", VK_Sparc_GOT10)
+ .Case("got13", VK_Sparc_GOT13)
+ .Case("r_disp32", VK_Sparc_R_DISP32)
+ .Case("tgd_hi22", VK_Sparc_TLS_GD_HI22)
+ .Case("tgd_lo10", VK_Sparc_TLS_GD_LO10)
+ .Case("tgd_add", VK_Sparc_TLS_GD_ADD)
+ .Case("tgd_call", VK_Sparc_TLS_GD_CALL)
+ .Case("tldm_hi22", VK_Sparc_TLS_LDM_HI22)
+ .Case("tldm_lo10", VK_Sparc_TLS_LDM_LO10)
+ .Case("tldm_add", VK_Sparc_TLS_LDM_ADD)
+ .Case("tldm_call", VK_Sparc_TLS_LDM_CALL)
+ .Case("tldo_hix22", VK_Sparc_TLS_LDO_HIX22)
+ .Case("tldo_lox10", VK_Sparc_TLS_LDO_LOX10)
+ .Case("tldo_add", VK_Sparc_TLS_LDO_ADD)
+ .Case("tie_hi22", VK_Sparc_TLS_IE_HI22)
+ .Case("tie_lo10", VK_Sparc_TLS_IE_LO10)
+ .Case("tie_ld", VK_Sparc_TLS_IE_LD)
+ .Case("tie_ldx", VK_Sparc_TLS_IE_LDX)
+ .Case("tie_add", VK_Sparc_TLS_IE_ADD)
+ .Case("tle_hix22", VK_Sparc_TLS_LE_HIX22)
+ .Case("tle_lox10", VK_Sparc_TLS_LE_LOX10)
+ .Case("hix", VK_Sparc_HIX22)
+ .Case("lox", VK_Sparc_LOX10)
+ .Case("gdop_hix22", VK_Sparc_GOTDATA_HIX22)
+ .Case("gdop_lox10", VK_Sparc_GOTDATA_LOX10)
+ .Case("gdop", VK_Sparc_GOTDATA_OP)
+ .Default(VK_Sparc_None);
}
Sparc::Fixups SparcMCExpr::getFixupKind(SparcMCExpr::VariantKind Kind) {
diff --git a/llvm/test/MC/Sparc/sparc-relocations.s b/llvm/test/MC/Sparc/sparc-relocations.s
index d99ddb7e2f802..82314e440acf6 100644
--- a/llvm/test/MC/Sparc/sparc-relocations.s
+++ b/llvm/test/MC/Sparc/sparc-relocations.s
@@ -10,6 +10,8 @@
! CHECK-OBJ-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_M44 sym
! CHECK-OBJ-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_L44 sym
! CHECK-OBJ-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HH22 sym
+ ! CHECK-OBJ-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HH22 sym
+ ! CHECK-OBJ-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HM10 sym
! CHECK-OBJ-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_HM10 sym
! CHECK-OBJ-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_LM22 sym
! CHECK-OBJ-NEXT: 0x{{[0-9,A-F]+}} R_SPARC_13 sym
@@ -49,10 +51,18 @@
! CHECK-NEXT: ! fixup A - offset: 0, value: %hh(sym), kind: fixup_sparc_hh
sethi %hh(sym), %l0
+ ! CHECK: sethi %hh(sym), %l0 ! encoding: [0x21,0b00AAAAAA,A,A]
+ ! CHECK-NEXT: ! fixup A - offset: 0, value: %hh(sym), kind: fixup_sparc_hh
+ sethi %uhi(sym), %l0
+
! CHECK: or %g1, %hm(sym), %g3 ! encoding: [0x86,0x10,0b011000AA,A]
! CHECK-NEXT: ! fixup A - offset: 0, value: %hm(sym), kind: fixup_sparc_hm
or %g1, %hm(sym), %g3
+ ! CHECK: or %g1, %hm(sym), %g3 ! encoding: [0x86,0x10,0b011000AA,A]
+ ! CHECK-NEXT: ! fixup A - offset: 0, value: %hm(sym), kind: fixup_sparc_hm
+ or %g1, %ulo(sym), %g3
+
! CHECK: sethi %lm(sym), %l0 ! encoding: [0x21,0b00AAAAAA,A,A]
! CHECK-NEXT: ! fixup A - offset: 0, value: %lm(sym), kind: fixup_sparc_lm
sethi %lm(sym), %l0
|
Note: this PR was created by |
s-barannikov
approved these changes
Jun 3, 2024
Created using spr 1.3.4
Created using spr 1.3.5
nekoshirro
pushed a commit
to nekoshirro/Alchemist-LLVM
that referenced
this pull request
Jun 9, 2024
This adds support for GNU %uhi and %ulo extensions. Those resolve to the same relocations as %hh and %hm. Reviewers: cyndyishida, dcci, brad0, jrtc27, aaupov, Endilll, rorth, maksfb, #reviewers-libcxxabi, s-barannikov, rafaelauler, ayermolo, #reviewers-libunwind, #reviewers-libcxx, daniel-grumberg, tbaederr Reviewed By: s-barannikov Pull Request: llvm#94246 Signed-off-by: Hafidz Muzakky <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds support for GNU %uhi and %ulo extensions.
Those resolve to the same relocations as %hh and %hm.